import numpy as np
import cv2 as cv 
import matplotlib.pyplot as plt
from skimage import io,data,color,util
#图像嵌在jupyter Notebook 网页中当前cell下显示
# %matplotlib inline

#从当前工作目录下img中读入彩色图像
img = io.imread('./img/2.jpg')

img_gray = color.rgb2gray(img)
img_gray = util.img_as_ubyte(img_gray)
io.imsave('sk_boats_gray.jpg',img_gray)
img_cat=data.chelsea()

plt.figure(figsize=(16,10))

plt.gray()
plt.subplot(1,3,1);plt.imshow(img)
plt.title('Color image');plt.axis('off')

plt.subplot(1,3,2);plt.imshow(img_gray,vmin=0,vmax=255)
plt.title('gray image');plt.axis('off')

plt.subplot(1,3,3);plt.imshow(img_cat)
plt.title('cat image');plt.axis('off')
plt.show()
